package com.chixing.ih.module.programmer.service.Impl;

import com.chixing.ih.module.programmer.mapper.ImageMapper;
import com.chixing.ih.module.programmer.pojo.ProjectImage;
import com.chixing.ih.module.programmer.pojo.UserImage;
import com.chixing.ih.module.programmer.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @version 1.0
 * @Author MasterYan
 * @Date 2020/10/3
 * Time: 17:03
 */
@Service
@Transactional
public class ImageServiceImpl implements ImageService {

    @Autowired
    ImageMapper imageMapper;


    @Override
    public boolean updateUserImage(UserImage image) {
        int record = imageMapper.updateUserOne(image);
        if (record > 0)
            return true;
        else
            return false;
    }

    @Override
    public boolean updateProjectImage(ProjectImage projectImage) {
        int record = imageMapper.updateProjectOne(projectImage);
        if (record > 0)
            return true;
        else
            return false;
    }

    @Override
    public ProjectImage getOneByUserId(long userId) {
        ProjectImage oneByProjectId = imageMapper.getOneByProjectId(userId);
        return oneByProjectId;
    }

    @Override
    public ProjectImage getOneByProjectId(long projectId) {
        ProjectImage oneByProjectId = imageMapper.getOneByProjectId(projectId);
        return oneByProjectId;
    }


}
